package oldcode;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SendclientChannelFutureListener{//  implements ChannelFutureListener{

	public static Logger logger = LoggerFactory.getLogger(SendclientChannelFutureListener.class);  
	
//	private BusMsgStatus<T> status;
//	
//	private BusStatusManager<T> statusManager;
//	
//	public SendclientChannelFutureListener(BusStatusManager<T> statusManager, BusMsgStatus<T> status)
//	{
//		this.statusManager = statusManager;
//		this.status = status;
//	}
//	
//	@Override
//	public void operationComplete(ChannelFuture future)
//			throws Exception {
//		
//		LogUtils.openTag(status.getTag());
//		
//		status.recordFinishSendClientTime();
//		String head = status.getName();
//		
//		if(status.getReqMsg() instanceof ThriftMessage)
//		{
//			head = ((ThriftMessage)status.getReqMsg()).getHead().toString();
//		}
//		else if(status.getReqMsg() instanceof BusMessage)
//		{
//			head = ((BusMessage)status.getReqMsg()).getHead().toString();
//		}
//		
//		if(future.isSuccess())
//		{	
//			logger.debug(LogPatterns.SEND_TO_CLIENT + "\n<<<耗时分析:{}>>>", future.channel().toString(), future.channel().remoteAddress().toString()
//					, status.getOldseq(), status.getNewseq(), head, status.spendTimeString());
//			statusManager.getStatusMap().remove(status.getKey());
//			status.release();
//		}
//		else 
//		{
//			boolean isOpen = future.channel().isOpen();
//			boolean isActive = future.channel().isActive();
//			boolean isRegistered = future.channel().isRegistered();
//			boolean isWritable = future.channel().isWritable();
//			
//			logger.error(LogPatterns.SEND_TO_CLIENT_FAIL + "\n isOpen: " + isOpen + "  isActive: " + isActive + "  isRegistered: " + isRegistered+ "  isWritable: " + isWritable, future.channel().toString(), future.channel().remoteAddress().toString()
//					, status.getOldseq(), status.getNewseq(), head);
//		}
//		
//		LogUtils.removeTag();
//		
//		future.removeListener(this);
//	}
}